//
//  SHBalanceModelView.m
//  JiFengDaRen
//
//  Created by Lyc on 2017/6/22.
//  Copyright © 2017年 SH_iOS. All rights reserved.
//


#import "SHBalanceModelView.h"
#import "UserBalanceModel.h"
@implementation SHBalanceModelView

+ (void)getUserBalanceLuckyInfoWithSuccess:(void(^)(UserBalanceModel *userBalanceModel))success complection:(void(^)(id result))complection failure:(void(^)(id erro))failure{
    
    UIViewController *vc =  [SHHelper currentViewController];
    dispatch_async(dispatch_get_main_queue(), ^{
        MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:vc.view animated:YES];
        hud.alpha = 0;
    });

    [MyDataService requestAFURL:KUser_get_balancelucky httpMethod:@"GET" params:nil data:nil complection:^(id result) {
        dispatch_async(dispatch_get_main_queue(), ^{
            [MBProgressHUD hideHUDForView:vc.view animated:YES];
        });
        SHLog(@"result = %@",result);
        if ([result[@"success"] boolValue]) {
            
            UserBalanceModel *newsModel = [UserBalanceModel mj_objectWithKeyValues:result[@"data"]];
            success(newsModel);

        }else{
            if ([result[@"data"] isKindOfClass:[NSString class]]) {
                [vc.view makeToast:result[@"data"] duration:2.f position:@"center"];
                complection(result);
            }
        }
       
    } failure:^(id erro) {
        dispatch_async(dispatch_get_main_queue(), ^{
            [MBProgressHUD hideHUDForView:vc.view animated:YES];
        });
        failure(erro);

        
    }];

}


@end
